<template>
  <div>
    <zc-table v-bind="config" :request="request">
      <template #handler="scope">
        <el-button link size="small" type="primary">编辑</el-button>
        <el-button link size="small" type="primary">删除</el-button>
      </template>
      <template #status="scope">
        <el-button>{{ scope.row.status === 0 ? "禁用" : "启用" }}</el-button>
      </template>
      <template #filters="scope">
        <el-tag
          :type="scope.row.tag === '312' ? '' : 'success'"
          disable-transitions
        >
          {{ scope.row.tag }}
        </el-tag>
      </template>
    </zc-table>
  </div>
</template>

<script setup lang="ts">
import { TableHeader } from "@/views/index/indexTableConfig";
import config from "./config";
const tableData: TableHeader[] = [
  {
    id: 1,
    name: "T",
    realname: "liu",
    tag: "312",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 2,
    name: "Tom",
    realname: "zi",
    tag: "123",
    status: 0,
  },
  {
    id: 3,
    name: "Tom",
    tag: "312",
    realname: "cheng1",
    status: 1,
  },
  {
    id: 4,
    name: "Tom",
    tag: "312",
    realname: "cheng",
    status: 1,
  },
];
const request: (params: any) => Promise<any> = (params) => {
  console.log("params", params);

  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(tableData);
    }, 1000);
  });
};
onMounted(() => {
  console.log("dataTable");
});
</script>

<style scoped lang="scss"></style>
